import Vuex from 'vuex';
import Vue from 'vue';

Vue.use(Vuex);
// eslint-disable-next-line import/prefer-default-export
export const store = new Vuex.Store({
  state: {// 相当于data
    banners: [],
    todayArray:[],
    havelook:[],
    anchor:[],
    thelatest:[],
    preferably:[],
    boutique:[],
    creation:[],
    header:'',
    friend:[],
    lyricsid: []

},
  getters: { // computed
    reverseB(state) {
      return state.b.split('').reverse().join('');
    },
  },
  mutations: { // methods（）
    //轮播
    getBanners(state, data) {
      state.banners = data;
    },
    //推荐歌单
    gettodayArray(state,data){
      state.todayArray = data;
    },
    //看看
    gethavelook(state,data){
      state.havelook = data;
    },
    //最新音乐
    getthelatest(state,data){
        state.thelatest = data;
    },
    //主播电台
    getanchor(state,data){
      state.anchor = data;
    },
    //今日优选
    getpreferably(state,data){
      state.preferably = data;
    },
    //精品推荐
    getboutique(state,data){
      state.boutique = data;
    },
    //创作翻唱以下
    getcreation(state,data){
      state.creation = data;
    },
    //搜索
    getheader(state,data){
      state.header = data;
    },
    //朋友
    getfriend(state,data){
      state.friend = data;
    }

  },
  actions: { // methods
    // eslint-disable-next-line no-shadow
    delA(store) {
      setTimeout(() => {
        store.commit('_delA');
      }, 5000);
    },
  },
});
